<%@page import="bean.vtableDTO"%>
<%@page import="bean.vtableVo"%>


<%@page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel ='stylesheet' href ="./css/one.css"/>
<script src="./js/one.js"></script>
</head>
<body>
<!-- 기억하게 하기 위해 type = 'hidden' 눈에 안보임-->

<jsp:useBean id="vo" class ="bean.vtableVo" scope = "page"/>
<jsp:setProperty property="*" name="vo"/>



<%

vtableDTO dto = new vtableDTO();
dto.setVo(vo);
ArrayList<vtableVo> al = dto.select();
 
String m="";
if(session.getAttribute("sessionMid")!=null){
	m = (String)session.getAttribute("sessionMid");
}
%>
<%-- <script>alert(<%=al.size()%>);</script> --%>
<form name = 'hiddenFrm' method='post'>
	<input type = 'hidden' name = 'nowPage' value = '<%=vo.getNowPage()%>'>
	<input type = 'hidden' name = 'find' value = '<%=vo.getFind()%>'>
	<input type = 'hidden' name = 'rno' value = '<%=vo.getRno()%>'>
	<input type ='hidden' id='smid' name='mid' value='<%=m %>'/>
</form>


<h1>아이들에게 한마디</h1>

<div id="vtable_list_find" style="width: 578px;" align="right" >
		<form action = 'index.jsp?inc=./one/list.jsp' name="vtable_list_frm" method="post">
		<lable>아이디</lable><input type = 'text' name ="find" value = '<%=vo.getFind()%>'/>		
		<input type = 'submit' value ="검색">
		<input type = 'button' id ="find1"value ="전체리스트">
	</form>
</div>
<div id = 'vtable_list_title'>
	<div class = 'vtable_list_rno'>순번</div>
	<div class = 'vtable_list_mid'>아이디</div>
	<div class = 'vtable_list_content'>내용</div>
	<div class = 'vtable_list_sysdate'>게시일</div>
</div>
<%
int en = dto.getEndNo();
if(en>al.size()){
	en=al.size();
}
for(int a = 0;a<en;a++){ 
vtableVo v = al.get(a);%>
<div class = 'vtable_list_tiems'>
	<div class = 'vtable_list_rno'><%=v.getRno()%></div>
	<div class = 'vtable_list_mid'><%=v.getMid() %></div>
	<div class = 'vtable_list_content'><a href = '#' onclick = 'goView(<%=dto.getNowPage()%>,<%=v.getRno()%>)'>
		<%=v.getContent() %></a></div>
	<div class = 'vtable_list_sysdate7'><%=v.getSysdate7() %></div>
</div>


<%}int i=0; %>

<div id = 'list_page'>
<a href ='#' onclick ='goPage(1)'>처음</a>

<%if(dto.getNowPage() !=1){%>
<a href ='#'onclick='goPage(<%=dto.getNowPage()-1%>)'>이전 페이지</a>
<%}%>

<%
for( i = dto.getStartPage(); i <= dto.getEndPage(); i++){
if(dto.getNowPage() ==i){
%>
<b><a href ='#'onclick='goPage(<%=i%>)'><%="["+i+"]"%></a></b>
<%}else{ %>
<a href ='#'onclick='goPage(<%=i%>)'><%="["+i+"]"%></a>
<%}
}%>

<%if(dto.getNowPage() !=dto.getTotPage()){%>
<a href ='#'onclick='goPage(<%=dto.getNowPage()+1%>)'>다음 페이지</a>
<%}%>

<%-- <%if(dto.getTotPage() != dto.getNowPage()){ %> --%>
<%-- <a href ='#'onclick='goPage(<%=i%>)'>다음</a> --%>
<%-- <%}%> --%>

<a href ='#'onclick='goPage(<%=dto.getTotPage()%>)'>마지막</a>



</div>
<input type = 'button' value ='한마디  작성' id='btnInput'/> <br>


<script>listInit();</script>

</body>
</html>